home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #1 / Ham Radio 2000.iso / ham2000 / tcp_ip / tnos / tnos100s / kissdump.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-04-30  |  1.5 KB  |  81 lines

  1. /* Tracing routines for KISS TNC
  2.  * Copyright 1991 Phil Karn, KA9Q
  3.  *
  4.  * Modified by G1EMM  19/11/90 to support multiport KISS mode.
  5.  */
  6.  
  7. #include "global.h"
  8. #include "mbuf.h"
  9. #include "kiss.h"
  10. #include "devparam.h"
  11. #include "ax25.h"
  12. #include "trace.h"
  13.  
  14. #ifdef TNOS_68K
  15. #define fprintf traceprintf
  16. #endif
  17.  
  18. void
  19. ki_dump(fp,bpp,check)
  20. FILE *fp;
  21. struct mbuf **bpp;
  22. int check;
  23. {
  24.     int type;
  25.     int val;
  26.  
  27.     fprintf(fp,"KISS: ");
  28.     type = PULLCHAR(bpp);
  29.     if((type & 0x0f) == PARAM_DATA){
  30.         fprintf(fp,"Port %d Data\n", type >> 4);
  31.         ax25_dump(fp,bpp,check);
  32.         return;
  33.     }
  34.     if(type == PARAM_RETURN){
  35.         fprintf(fp,"RETURN\n");
  36.         return;
  37.     } else {
  38.         fprintf(fp,"Port %d ", type >> 4);
  39.     }
  40.     val = PULLCHAR(bpp);
  41.     switch(type & 0x0f){
  42.     case PARAM_TXDELAY:
  43.         fprintf(fp,"TX Delay: %lu ms\n",val * 10L);
  44.         break;
  45.     case PARAM_PERSIST:
  46.         fprintf(fp,"Persistence: %u/256\n",val + 1);
  47.         break;
  48.     case PARAM_SLOTTIME:
  49.         fprintf(fp,"Slot time: %lu ms\n",val * 10L);
  50.         break;
  51.     case PARAM_TXTAIL:
  52.         fprintf(fp,"TX Tail time: %lu ms\n",val * 10L);
  53.         break;
  54.     case PARAM_FULLDUP:
  55.         fprintf(fp,"Duplex: %s\n",val == 0 ? "Half" : "Full");
  56.         break;
  57.     case PARAM_HW:
  58.         fprintf(fp,"Hardware %u\n",val);
  59.         break;
  60.     default:
  61.         fprintf(fp,"code %u arg %u\n",type,val);
  62.         break;
  63.     }
  64. }
  65.  
  66. int
  67. ki_forus(iface,bp)
  68. struct iface *iface;
  69. struct mbuf *bp;
  70. {
  71.     struct mbuf *bpp;
  72.     int i;
  73.  
  74.     if((bp->data[0] & 0x0f) != PARAM_DATA)
  75.         return 0;
  76.     dup_p(&bpp,bp,1,AXALEN);
  77.     i = ax_forus(iface,bpp);
  78.     free_p(bpp);
  79.     return i;
  80. }
  81.